package com.settlement.system.model.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.settlement.system.common.base.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
        import java.math.BigDecimal;
import java.util.List;

/**
* <p>
* 天猫账单明细
* </p>
*
* @author huangrensen
* @since 2024-04-15
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class SysTmBillDetail extends BaseEntity implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
    * 主键
    */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;


    /**
    * 订单表ID
    */
    private String orderId;
    @TableField(exist = false)
    private String tableName;
    @TableField(exist = false)
    // 批量查询
    private List<String> orderIds;

    /**
    * 买家应付货款
    */
    private BigDecimal buyerPayableAmount = BigDecimal.ZERO;


    /**
    * 买家应付邮费
    */
    private BigDecimal buyerPayablePostage = BigDecimal.ZERO;


    /**
    * 总金额
    */
    private BigDecimal buyerPayableTotalAmount = BigDecimal.ZERO;


    /**
    * 买家实际支付金额
    */
    private BigDecimal buyerPayableActAmount = BigDecimal.ZERO;


    /**
    * 卖家服务费
    */
    private BigDecimal sellerServiceAmount = BigDecimal.ZERO;


    /**
    * 买家服务费
    */
    private BigDecimal buyerServiceAmount = BigDecimal.ZERO;


    /**
    * 购物金充值本金
    */
    private BigDecimal purchaseRechargeAmount = BigDecimal.ZERO;


    /**
    * 购物金充值权益金
    */
    private BigDecimal purchaseRechargeQyAmount = BigDecimal.ZERO;


    /**
    * 购物金消费本金
    */
    private BigDecimal purchaseConsumeAmount = BigDecimal.ZERO;


    /**
    * 购物金消费权益金
    */
    private BigDecimal purchaseConsumeQyAmount = BigDecimal.ZERO;


    /**
    * 退款金额
    */
    private BigDecimal refundAmount = BigDecimal.ZERO;


    /**
    * 天猫卡券抵扣
    */
    private BigDecimal cardDeduction = BigDecimal.ZERO;


    /**
    * 集分宝抵扣
    */
    private BigDecimal jfbDeduction = BigDecimal.ZERO;


    /**
    * 打款商家金额
    */
    private BigDecimal payoutsAmount = BigDecimal.ZERO;


    /**
    * 含应开票给个人的个人红包
    */
    private BigDecimal personalRedPackets = BigDecimal.ZERO;


    /**
    * 前N有礼
    */
    private String nGift;


    /**
    * 返现金额
    */
    private BigDecimal cashbackAmount = BigDecimal.ZERO;


    /**
    * 延迟发货主动赔付金额
    */
    private BigDecimal delaySendIndemnityAmount = BigDecimal.ZERO;


    /**
    * 交易付款
    */
    private BigDecimal tradePayAmount = BigDecimal.ZERO;


    /**
    * 售后退款
    */
    private BigDecimal afterSalesAmount = BigDecimal.ZERO;


    /**
    * 花呗支付服务费
    */
    private BigDecimal hbPayableAmount = BigDecimal.ZERO;


    /**
    * 代扣返点积分
    */
    private String dkReturnPoints;


    /**
    * 代扣款 天猫佣金 类目
    */
    private String commissionSubjects;


    /**
    * 信用卡支付服务费
    */
    private BigDecimal creditCardPayableAmount = BigDecimal.ZERO;


    /**
    * 淘宝内容推广服务费
    */
    private BigDecimal popularizeAmount = BigDecimal.ZERO;


    /**
    * 聚划算佣金
    */
    private BigDecimal jhsAmount = BigDecimal.ZERO;


    /**
    * 代扣款-天猫佣金-赠品
    */
    private String commissionGifts;


    /**
    * 保险承保-卖家版运费险保费收取
    */
    private String chargeServiceAmount;


    /**
    * 淘宝客佣金代扣款
    */
    private String tbkCommissionAmount;


    /**
    * 保险承保-天猫海外退货险保费收取
    */
    private String chargeReturnAmount;


    /**
    * 保险承保-聚划算运费险保费收取
    */
    private String jhsServiceAmount;


    /**
    * 保证金退款
    */
    private BigDecimal depositAmount = BigDecimal.ZERO;


    /**
    * 代扣款-“海外零售计划”供应链管理服务费扣款
    */
    private String supplyChainAmount;


    /**
    * 保险理赔-天猫海外退货险理赔款
    */
    private String claimsAmount;


    /**
    * 代扣款-天猫佣金-补差价/邮费
    */
    private String differencePostAmount;


    /**
    * 代扣款-天猫佣金-类目系统
    */
    private String subjectsSystem;


    /**
    * 保险承保-严选直播运费险保费收取
    */
    private String broadcastServiceAmount;


    /**
    * 品牌新享-首单拉新计划
    */
    private String newPlan;


    /**
    * 信用购分期-保证金退款
    */
    private String creditDepositAmount;


    /**
    * 其他
    */
    private String other;


    /**
    * 宝贝总数量
    */
    private Integer productQty = 0;


    /**
    * 支付详情
    */
    private String payDetail;


    /**
    * 买家支付积分
    */
    private String buyerPoints;


    /**
    * 返点积分
    */
    private String returnPoints;


    /**
    * 买家实际支付积分
    */
    private String buyerActPoints;


    /**
    * 买家留言
    */
    private String buyerRemark;


    /**
    * 运送方式
    */
    private String transportType;


    /**
    * 宝贝标题
    */
    private String productTitle;


    /**
    * 宝贝种类
    */
    private String productType;


    /**
    * 物流单号
    */
    private String transportNo;


    /**
    * 物流公司
    */
    private String transportCompany;


    /**
    * 备注标签
    */
    private String remarkLabel;


    /**
    * 商家备注
    */
    private String sellerRemark;


    /**
    * 店铺Id
    */
    private String tmStoreId;


    /**
    * 店铺名称
    */
    private String tmStoreName;


    /**
    * 发票抬头
    */
    private String invoiceTitle;


    /**
    * 是否手机订单
    */
    private String phoneBill;


    /**
    * 分阶段订单信息
    */
    private String phasedOrderInfo;


    /**
    * 特权订金订单id
    */
    private String depositOrderId;


    /**
    * 是否上传合同照片
    */
    private String uploadContract;


    /**
    * 是否上传小票
    */
    private String uploadReceipts;


    /**
    * 是否代付
    */
    private String otherPay;


    /**
    * 定金排名
    */
    private String depositRanking;


    /**
    * 修改后的sku
    */
    private String modifySku;


    /**
    * 异常信息
    */
    private String exceptionMessage;


    /**
    * 是否是O2O交易
    */
    private String oto;


    /**
    * 新零售交易类型
    */
    private String newTradeType;


    /**
    * 新零售导购门店名称
    */
    private String newTradeStoreName;


    /**
    * 新零售导购门店id
    */
    private String newTradeSellerId;


    /**
    * 新零售发货门店名称
    */
    private String newTradeSendStoreName;


    /**
    * 新零售发货门店id
    */
    private String newTradeSendStoreId;


    /**
    * 预约门店
    */
    private String bookStore;


    /**
    * 是否信用购
    */
    private String creditCard;


    /**
    * 体验期结束时间
    */
    private String trialEndTime;


    /**
    * 配送类型
    */
    private String distributionType;


    /**
    * 直播返现状态
    */
    private String broadcastReturnStatus;


    /**
    * 是否赔付
    */
    private String claims;


    /**
    * 赔付出账时间
    */
    private String claimsTime;


    /**
    * 新零售成交门店昵称
    */
    private String newTradeDealStore;


    /**
    * 新零售成交门店id
    */
    private String newTradeDealStoreId;


    /**
    * 新零售成交经销商id
    */
    private String newTradeDealer;


    /**
    * 预售订单
    */
    private String preSaleOrder;


    /**
    * 预售订单商家备注
    */
    private String preSaleSellerRemark;


    /**
    * 预售下沉结果
    */
    private String preSaleResult;


    /**
    * hold状态
    */
    private String hoverStatus;

    /**
    * 主订单编号
    */
    private String tmMainOrderNo;

    /**
    * 补差订单
    */
    private String bcOrder;

    /**
    * 淘特订单
    */
    private String ttOrder;

    // 截取长度超出范围的字段
    public void cutString() {
        if (this.nGift != null && this.nGift.length() > 50) {
            this.nGift = this.nGift.substring(0, 50);
        }
        if (this.other != null && this.other.length() > 1000) {
            this.other = this.other.substring(0, 1000);
        }
        if (this.payDetail != null && this.payDetail.length() > 2000) {
            this.payDetail = this.payDetail.substring(0, 2000);
        }
        if (this.buyerRemark != null && this.buyerRemark.length() > 2000) {
            this.buyerRemark = this.buyerRemark.substring(0, 2000);
        }
        if (this.productTitle != null && this.productTitle.length() > 2000) {
            this.productTitle = this.productTitle.substring(0, 2000);
        }
        if (this.sellerRemark != null && this.sellerRemark.length() > 2000) {
            this.sellerRemark = this.sellerRemark.substring(0, 2000);
        }
        if (this.remarkLabel != null && this.remarkLabel.length() > 50) {
            this.remarkLabel = this.remarkLabel.substring(0, 50);
        }
        if (this.phasedOrderInfo != null && this.phasedOrderInfo.length() > 50) {
            this.phasedOrderInfo = this.phasedOrderInfo.substring(0, 50);
        }
        if (this.exceptionMessage != null && this.exceptionMessage.length() > 2000) {
            this.exceptionMessage = this.exceptionMessage.substring(0, 2000);
        }
        if (this.preSaleSellerRemark != null && this.preSaleSellerRemark.length() > 2000) {
            this.preSaleSellerRemark = this.preSaleSellerRemark.substring(0, 2000);
        }
    }

}
